import request from "@/utils/request";
import type { trademarkResponseData } from "./model";

enum API {
  trademarkInfo = "/admin/product/baseTrademark/",
  addTradeMark = "/admin/product/baseTrademark/save",
  updateTrademark = "/admin/product/baseTrademark/update",
  deleteTrademark = "/admin/product/baseTrademark/remove/"
}

//获取品牌数据
export const reqTrademarkInfo = (page: number, limit: number) =>
  request.get<any, trademarkResponseData>(
    API.trademarkInfo + `${page}/${limit}`
  );
//新增和更新品牌数据
export const reqAddOrUpdateTrademarkInfo = (data: any) => {
  if (data.id) {
    return request.put(API.updateTrademark, data);
  } else {
    return request.post(API.addTradeMark, data);
  }
};
//删除品牌数据
export const reqDeleteTrademarkInfo = (id:number) => 
request.delete(API.deleteTrademark + id)